﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DormMS.Model.ViewModels
{
    public class ProductResponse : Product
    {
        /// <summary>
        /// 可销库存
        /// </summary>
        public int CanSaleStock { get; set; }

        public string CategoryNameList { get; set; }

    }

    public class ProductEditResponse
    {
        public ProductInfo ProductMain { get; set; }

        public List<Product_SpecType> SpecTypeList { get; set; }

        public List<Product_SpecTemplate> ChooseSpecTemplateList { get; set; }

        public List<Product_SpecTemplateItem> ChooseSpecItemList { get; set; }

        public List<Product_Category> CategoryList { get; set; }

        public List<FreightTemplate> FreightList { get; set; }

        public List<SpecResponse> SpecList { get; set; }

        public List<SpecTemplateResponse> SpecTemplateResponse { get; set; }
    }

    public class ProductInfo : Product
    {
        public int FirstCategoryId { get; set; }

        public int SetFreightType
        {
            get
            {
                if (FreightTemplateId > 0)
                {
                    return 1;
                }
                else if (Id == 0)
                {
                    return -1;
                }
                else
                {
                    return 0;
                }
            }
        }

        public List<string> SubImgUrls { get; set; }

        public decimal MaxPrice { get; set; }
    }

    public class SpecResponse : Product_Spec
    {
        public List<Product_SpecTemplateItem> SpecItemList { get; set; }

        public int CanSaleStock
        {
            get
            {
                return Stock - WaitSendStock;
            }
        }

        public string ImgUrl { get; set; }

        public int ProductId { get; set; }

        public string Name { get; set; }

        public int CategoryId { get; set; }

        /// <summary>
        /// 是否支持积分抵现
        /// </summary>
        public bool IsAllowUsePoints { get; set; }

        /// <summary>
        /// 使用积分比例
        /// </summary>
        public decimal UsePointRate { get; set; }
        public bool IsAllowUseCoupon { get; set; }

        /// <summary>
        /// 运费模版ID
        /// </summary>
        public int FreightTemplateId { get; set; }

        /// <summary>
        /// 统一运费
        /// </summary>
        public decimal UniformFreight { get; set; }

        private int bugCount = 1;

        public int BuyCount { get { return bugCount; } set { bugCount = value; } }

    }

    public class SpecTypeChangeResponse
    {
        public List<SpecTemplateResponse> SpecTemplateResponse { get; set; }

        public List<SpecResponse> SpecList { get; set; }

        public List<Product_SpecTemplate> ChooseSpecTemplateList { get; set; }

        public List<Product_SpecTemplateItem> ChooseSpecItemList { get; set; }
    }

    public class SpecTemplateResponse : Product_SpecTemplate
    {
        public List<Product_SpecTemplateItem> SpecItemResponseList { get; set; }
    }


    public class GetFreightInfoResponse : FreightTemplate
    {
        public List<FreightTemplateDetails> FreightDetail { get; set; }
    }

    public class ChooseSpecItemResponse
    {
        public List<SpecResponse> SpecList { get; set; }

        public List<Product_SpecTemplate> ChooseSpecTemplateList { get; set; }
    }


    public class ProductDetailResponse
    {
        public ProductInfo ProductMain { get; set; }

        public List<SpecResponse> SpecList { get; set; }

        public int ShopCartCount { get; set; }

        public bool IsFavorited { get; set; }

        public string SpikeEndTime { get; set; }

        public string SpikeBeginTime { get; set; }

        public int SpikeLimit { get; set; }

        public string ShareTittle { get; set; }

        public string ShareContent { get; set; }

        public string ShareImg { get; set; }
    }

    public class ProductCommentInfo : Product_Comment
    {
        public List<string> ImgList { get; set; }
    }


}
